<template>
	<view>
		<view class="header">
			您当前所在位置为：{{position}}
		</view>
		<view class="list-box">
			<view 
				class="list-item" 
				@click="clickListItem(item)"
				v-for="(item,index) in list" 
				:key="item.id">
				<view class="left">
					{{item.completeInfo}}
				</view>
				<view class="right">
					<text>点击选择</text>
					<text class="iconfont icon-icon-test61"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				unitId: null,
				position: '',
				current: 1,
				limit: 12,
				// 每页的数据
				list: [],
				total: 0,
				pages: 0
			};
		},
		onLoad(opt) {
			this.unitId = opt.unitId
			this.position = opt.position
			this.getHomeList()
		},
		methods:{
			clickListItem(item){
				uni.redirectTo({
					url: '../improveInfo?homeId='+item.id+'&homeInfo='+item.completeInfo
				})
			},
			getHomeList(){
				this.$myReq({
					url: `owner/client/admin/property/buildingHome/getHomePageByUnit/${this.current}/${this.limit}/${this.unitId}`,
					method:'POST'
				})
				.then((res) => {
					this.list = res.data.records
					this.total = res.data.total
					this.pages = res.data.pages
					this.current = res.data.current
				})
			}
		}
	}
</script>

<style lang="scss">
	.header{
		padding: 30rpx 30rpx 30rpx 30rpx;
		border-bottom: 1px solid #b6b6b6;
	}
	.list-box{
		padding: 0rpx 30rpx 0rpx 30rpx;
		background: #ffffff;
		.list-item{
			border-bottom: 1px solid #dddddd;
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			width: 100%;
			height: 80rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			.left{
				height: 100%;
				line-height:80rpx;
				font-size: 35rpx;
			}
			.right{
				height: 100%;
				// width: 30%;
				line-height: 80rpx;
				text{
					margin-right: 30rpx;
					font-size: 30rpx;
					color: #515151;
				}
				text:nth-child(2){
					margin-right: 20rpx
				}
				
			}
		}
	}
</style>
